*******Pew Research Center Poll: PEW RESEARCH CENTER May 2012 POLITICAL SURVEY
use "Pew Threat/Pew Data/Pew_2012_May.dta", clear

*Year
gen year=2012

*CC Threat
gen CCthreat1=Q13F
recode CCthreat1 ///
		(1=3 "Major threat") ///
		(2=2 "Minor threat") ///
		(3=1 "Not a threat") ///
		(else=.), ///
		gen(CCthreat)
lab var CCthreat "Climate Change Threat"
drop CCthreat1

*Party Preference
recode PARTY ///
	(1 = 1 "GOP") ///
	(2 = 3 "Democrat") ///
	(else = 2 "Independent"), ///
	gen(partyid)
lab var partyid "Party Preference"

replace partyid=1 if PARTYLN==1
replace partyid=3 if PARTYLN==2

*Gender
recode SEX ///
	(1=0 "Male") ///
	(2=1 "Female") ///
	(else=.), ///
	gen(female)
lab var female "Female"	

*Age
gen age=AGE
replace age=. if age==99
lab var age "Age"

*Cohort
gen age_cohort = year-AGE
replace age_cohort=. if AGE== 98|AGE ==99
recode age_cohort ///
	(1900/1904=1 "1900-1904") ///
	(1905/1909=2 "1905-1909") ///
	(1910/1914=3 "1910-1914") ///
	(1915/1919=4 "1915-1919") ///
	(1920/1924=5 "1920-1924") ///
	(1925/1929=6 "1925-1929") ///
	(1930/1934=7 "1930-1934") ///
	(1935/1939=8 "1935-1939") ///
	(1940/1944=9 "1940-1944") ///
	(1945/1949=10 "1945-1949") ///
	(1950/1954=11 "1950-1954") ///
	(1955/1959=12 "1955-1959") ///
	(1960/1964=13 "1960-1964") ///
	(1965/1969=14 "1965-1969") ///
	(1970/1974=15 "1970-1974") ///
	(1975/1979=16 "1975-1979") ///
	(1980/1984=17 "1980-1984") ///
	(1985/1989=18 "1985-1989") ///
	(1990/1994=19 "1990-1994") ///
	(1995/1999=20 "1995-1999") ///
	(2000/2004=21 "2000-2004"), ///
	gen(cohort)
la var cohort "Age Cohort, 5 yr. intervals"

*Education
recode EDUC ///
	(1 2=1 "<HS") ///
	(3 4=2 "HS Graduate") ///
	(5=3 "Some College") ///
	(6 7 8=4 "College Graduate") ///
	(else=.), ///
	gen(education)
lab var education "Education"

*Racial Identity
recode RACETH_G ///
	(1=1 "White") ///
	(2=2 "Black") ///
	(3=3 "Hispanic") ///
	(4=4 "Other") ///
	(else=.), ///
	gen(race)
lab var race "Racial Identity"

*Rural Inhabitance
/*NA IN 2020
gen DENSITY=density
recode DENSITY ///
	(1=5 "Lowest density") ///
	(2=4) ///
	(3=3 "Middle density") ///
	(4=2) ///
	(5=1 "Highest density") ///
	(else=.), ///
	gen(density1)
drop density DENSITY
rename density1 density
lab var density "Population Density"
*/

encode USR, gen(rural1)
recode rural1 ///
	(2 3=0 "Sub/Urban") ///
	(1=1 "Rural") ///
	(else=.), ///
	gen(rural)
lab var rural "Rural Inhabitance"
drop rural1
	
*Southern State
recode CREGION ///
	(1 2 4 = 0 "not South") ///
	(3=1 "South") ///
	(else=.), ///
	gen(south)
lab var south "Southern State"

*weight
gen weight=WEIGHT


*ID
gen id=PSRAID+20120000

*Keep and save
keep CCthreat partyid female age ///
	education race rural south ///
	year weight id cohort
save "Pew Threat/Individual Recoded Pew Files/Pew_2012_May_Recode", replace

/*test
ologit CCthreat partyid female age education race rural south
